class ConcreteFruitFactory extends FruitFactoryTemplate {
    @Override
    protected Fruit createFruitInstance(String type) {
        switch (type.toUpperCase()) {
            case "A": return new Apple();
            case "B": return new Banana();
            default: throw new IllegalArgumentException("未知水果类型");
        }
    }

    @Override
    protected void postCreateHook(Fruit fruit) {
        super.postCreateHook(fruit);
        System.out.println("扩展后处理：" + fruit.getClass().getSimpleName() + "已就绪");
    }
}